﻿ --区域
CREATE TABLE AREA
(		
	AREA_ID varchar(20) NOT NULL,
	WH_ID varchar(30) NULL,
	DESCR varchar(100) NULL,
	IS_ACTIVE varchar(1) NOT NULL,
	SYSTEM_CREATED varchar(1) NOT NULL,
	CREATED_BY varchar(20) NOT NULL,
	CREATED_DATE datetime NOT NULL,
	UPDATED_BY varchar(20) NOT NULL,
	UPDATED_DATE datetime NOT NULL,
	PRIMARY KEY(AREA_ID)
)
go

--区域明细，区域和储区的关系，一个AREA包括多个ZONE
CREATE TABLE AREA_DETAIL
(	
	AREA_ID varchar(20) NOT NULL,
	ZONE_ID varchar(20) NOT NULL,
	WH_ID varchar(30) NULL,
	SEQ_NO int NOT NULL,
	CREATED_BY varchar(20) NOT NULL,
	CREATED_DATE datetime NOT NULL,
	UPDATED_BY varchar(20) NOT NULL,
	UPDATED_DATE datetime NOT NULL,
	PRIMARY KEY (AREA_ID,	ZONE_ID)
)
go

--储区
CREATE TABLE ZONE
(	
	ZONE_ID varchar(20) NOT NULL,
	WH_ID varchar(30) NULL,
	DESCR varchar(100) NOT NULL,
	VERIFICATION_METHOD varchar(10) NOT NULL,
	PICK_TO_LOC varchar(20) NULL,
	IN_LOC varchar(20) NOT NULL,
	OUT_LOC varchar(20) NOT NULL,
	UOM1_PICK_METHOD varchar(1) NOT NULL,
	UOM2_PICK_METHOD varchar(1) NOT NULL,
	UOM3_PICK_METHOD varchar(1) NOT NULL,
	UOM4_PICK_METHOD varchar(1) NOT NULL,
	UOM5_PICK_METHOD varchar(1) NOT NULL,
	UOM6_PICK_METHOD varchar(1) NOT NULL,
	CLEAN_LOCATION varchar(1) NULL,
	TOP_OFF varchar(1) NULL,
	REPLENISHMENT_FLAG varchar(1) NULL,
	REPLENISHMENT_HOT_LEVEL varchar(1) NULL,
	REPLENISHMENT_METHOD varchar(10) NOT NULL,
	MAX_CUBE float NOT NULL,
	MAX_WEIGHT float NOT NULL,
	MAX_CASECNT decimal(22, 5) NOT NULL,
	MAX_PALLETS_PER_SKU int NOT NULL,
	CREATE_ASSIGNMENTS varchar(1) NOT NULL,
	ZONE_BREAK varchar(1) NOT NULL,
	MAX_PICK_LINES int NOT NULL,
	MAX_PICKING_CONTAINERS int NOT NULL,
	LABOR_MAX_CASECNT int NOT NULL,
	LABOR_MAX_CUBE int NOT NULL,
	LABOR_MAX_WEIGHT int NOT NULL,
	AISLE_START int NOT NULL,
	AISLE_END int NOT NULL,
	SLOT_START int NOT NULL,
	SLOT_END int NOT NULL,
	IS_ACTIVE varchar(1) NOT NULL,
	SYSTEM_CREATED varchar(1) NOT NULL,
	CREATED_BY varchar(20) NOT NULL,
	CREATED_DATE datetime NOT NULL,
	UPDATED_BY varchar(20) NOT NULL,
	UPDATED_DATE datetime NOT NULL,
 PRIMARY KEY(ZONE_ID)
 )
 go
 
--货位
CREATE TABLE LOCATION
(

	LOC varchar(20) NOT NULL,
	WH_ID varchar(30) NULL,
	LOC_TEMPLATE_ID varchar(20) NULL,
	LOC_USAGE varchar(20) NOT NULL,
	LOC_CATEGORY varchar(20) NOT NULL,
	LOC_FLAG varchar(20) NOT NULL,
	LOC_HANDLING varchar(20) NOT NULL,
	CHECK_DIG varchar(20) NULL,
	ABC varchar(1) NOT NULL,
	STATUS varchar(10) NOT NULL,
	ZONE_ID varchar(20) NOT NULL,
	LOGICAL_LOC varchar(20) NOT NULL,
	IS_MULTI_SKU varchar(1) NOT NULL,
	IS_MULTI_LOT varchar(1) NOT NULL,
	IS_LOSE_ID varchar(1) NOT NULL,
	X_COORD int NOT NULL,
	Y_COORD int NOT NULL,
	Z_COORD int NOT NULL,
	LOC_LEVEL int NOT NULL,
	LENGTH float NOT NULL,
	WIDTH float NOT NULL,
	HEIGHT float NOT NULL,
	CUBE float NOT NULL,
	CUBIC_CAPACITY float NOT NULL,
	WEIGHT_CAPACITY float NOT NULL,
	STACK_LIMIT int NOT NULL,
	FOOT_PRINT int NOT NULL,
	TEMPLATE_FIELD1 varchar(20) NULL,
	TEMPLATE_FIELD2 varchar(20) NULL,
	TEMPLATE_FIELD3 varchar(20) NULL,
	TEMPLATE_FIELD4 varchar(20) NULL,
	TEMPLATE_FIELD5 varchar(20) NULL,
	IS_ACTIVE varchar(1) NOT NULL,
	SYSTEM_CREATED varchar(1) NOT NULL,
	CREATED_BY varchar(20) NOT NULL,
	CREATED_DATE datetime NOT NULL,
	UPDATED_BY varchar(20) NOT NULL,
	UPDATED_DATE datetime NOT NULL,
	PRIMARY KEY(LOC)
 )
 go
 
 --货位模板
 CREATE TABLE LOCATION_TEMPLATE
(		
	LOC_TEMPLATE_ID varchar(20) NOT NULL,
	WH_ID varchar(30) NULL,
	FIELD1_LENGTH int NULL,
	FIELD1_TYPE varchar(20) NULL,
	FIELD1_DESC varchar(50) NULL,
	FIELD2_LENGTH int NULL,
	FIELD2_TYPE varchar(20) NULL,
	FIELD2_DESC varchar(50) NULL,
	FIELD3_LENGTH int NULL,
	FIELD3_TYPE varchar(20) NULL,
	FIELD3_DESC varchar(50) NULL,
	FIELD4_LENGTH int NULL,
	FIELD4_TYPE varchar(20) NULL,
	FIELD4_DESC varchar(50) NULL,
	FIELD5_LENGTH int NULL,
	FIELD5_TYPE varchar(20) NULL,
	FIELD5_DESC varchar(50) NULL,
	SEPERATOR_CHAR varchar(1) NULL,
	IS_ACTIVE varchar(1) NOT NULL,
	CREATED_BY varchar(20) NOT NULL,
	CREATED_DATE datetime NOT NULL,
	UPDATED_BY varchar(20) NOT NULL,
	UPDATED_DATE datetime NOT NULL,
	PRIMARY KEY(LOC_TEMPLATE_ID)
)
go

 